import {
	defineStore
} from 'pinia';
import {
	getSubUser
} from '../common/api.config.js'

export const vipListStore = defineStore('vipList', {
	state: () => {
		return {
			list: [1, 2]
		};
	},
	getters:{
		// 给首页用
		first:(state) => state.list[0]
	},
	// 也可以这样定义
	// state: () => ({ count: 0 })
	actions: {
		increment() {
			this.count++;
		},
		async getList() {
			const {
				data,
				code
			} = await getSubUser()
			if(code == 1){
				this.list = data
			}
		}
	},
});
